import { Component, OnInit } from '@angular/core';
import { StorageService } from 'src/app/sevices/storage.service';
import { Router } from '@angular/router';
import { HttpClient } from '@angular/common/http';

@Component({
  selector: 'app-center',
  templateUrl: './center.component.html',
  styleUrls: ['./center.component.scss']
})
export class CenterComponent implements OnInit {

  // 用户是否登录
  public register = true;
  // 个人中心列表
  public centerList = [];
  // 头像
  public img = '';
  // 昵称
  public tel = '';

  constructor(
    private storage: StorageService,
    public router: Router,
  ) { }

  ngOnInit() {
    // 获取的用户信息列表
    const user = this.storage.getItem('user');
    // 检查是否登录，如果登录获取用户头像昵称信息
    if (this.storage.getItem('user')) {
      // 表示用户已经登录
      this.register = false;
      this.img = user.u_img;
      this.tel = user.u_tel;
    }
  }

}
